package com.zhuidian.mothernote.activity;

import android.app.Fragment;
import android.view.View;

import com.base.presenter.BasePresenter;
import com.base.presenter.BaseView;
import com.base.view.MyTabWidget;
import com.zhuidian.mothernote.R;
import com.zhuidian.mothernote.fragment.AnswerAndEarnRedDevelopFragment;
import com.zhuidian.mothernote.fragment.DiscoverFragment;
import com.zhuidian.mothernote.fragment.HomeFragment;
import com.zhuidian.mothernote.fragment.MineFragment;
import com.zhuidian.mothernote.global.BaseActivity;
import com.zhuidian.mothernote.presenter.HomePresenter;

public class HomeActivity extends BaseActivity implements BaseView {

    private HomePresenter homePresenter;
    private MyTabWidget myTabWidget;
    private HomeFragment homeFragment;
    private DiscoverFragment discoverFragment;
    private AnswerAndEarnRedDevelopFragment answerAndEarnRedDevelopFragment;
    private MineFragment mineFragment;

    @Override
    protected int inflateMainLayoutId() {
        return R.layout.activity_home;
    }

    @Override
    protected void initView(View view) {
        myTabWidget = (MyTabWidget) view.findViewById(R.id.myTabWidget);
        myTabWidget.setSelectionChangedListener(new MyTabWidget.OnMyTabSelectionChanged() {
            @Override
            public void onTabSelectionChanged(int tabIndex, boolean clicked) {
                switchFragment(tabIndex);
            }
        });
        myTabWidget.setCurrentTab(0);
        setTopGone();
        homeFragment = new HomeFragment();
        answerAndEarnRedDevelopFragment = new AnswerAndEarnRedDevelopFragment();
        new AnswerAndEarnRedDevelopFragment();
        discoverFragment = new DiscoverFragment();
        mineFragment = new MineFragment();
        initMultiFragment(R.id.fl_fragment, new Fragment[]{homeFragment, answerAndEarnRedDevelopFragment, discoverFragment, mineFragment});

    }

    @Override
    protected void setListener() {

    }

    @Override
    protected BasePresenter getPresenter() {
        homePresenter = new HomePresenter();
        return homePresenter;
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);

    }
}
